# 不同颜色的提取
import cv2 as cv


def color_space_demo(image):
    gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
    cv.imshow("gray", gray)
    hsv = cv.cvtColor(image, cv.COLOR_BGR2HSV)
    cv.imshow("hsv", hsv)
    hls = cv.cvtColor(image, cv.COLOR_BGR2HLS)
    cv.imshow("hls", hls)
    yuv = cv.cvtColor(image, cv.COLOR_BGR2YUV)
    cv.imshow("yuv", yuv)
    ycrcb = cv.cvtColor(image, cv.COLOR_BGR2YCrCb)
    cv.imshow("ycrcb", ycrcb)
    cv.waitKey(0)
    cv.destroyWindow()


img = cv.imread("lena.png", cv.IMREAD_UNCHANGED)
color_space_demo(img)